package cn.com.bluemoon.daps.api.sys.factory;

import cn.com.bluemoon.daps.common.constant.ServiceNameConstants;
import cn.com.bluemoon.daps.common.domain.ResultBean;
import cn.com.bluemoon.daps.common.toolkit.FeignClientTools;
import cn.com.bluemoon.daps.api.sys.RemoteSystemBizLineService;
import cn.com.bluemoon.daps.system.vo.BizLineDetailResponseVo;
import cn.com.bluemoon.daps.system.vo.BizLineResponseVo;
import feign.hystrix.FallbackFactory;

import java.util.Collections;
import java.util.List;

/**
 * @author Jarod.Kong
 */
public class RemoteSysBizLineFallbackFactory implements FallbackFactory<RemoteSystemBizLineService> {
    @Override
    public RemoteSystemBizLineService create(Throwable throwable) {
        return new RemoteSystemBizLineService() {
            @Override
            public ResultBean<List<BizLineResponseVo>> bizLines() {
                return FeignClientTools.INSTANCE.errorMsgCatch(throwable, ServiceNameConstants.DapsApiStandard.PROD_SERVICE, "获取业务线列表失败");
            }

            @Override
            public ResultBean<BizLineResponseVo> getById(String bizLineId) {
                return FeignClientTools.INSTANCE.errorMsgCatch(throwable, ServiceNameConstants.DapsApiStandard.PROD_SERVICE, "获取业务线失败");
            }

            @Override
            public ResultBean<List<BizLineResponseVo>> bizLinesByDataManagerUserId(String userId) {
                return FeignClientTools.INSTANCE.errorMsgCatch(throwable, ServiceNameConstants.DapsApiStandard.PROD_SERVICE, "工号获取业务线失败");
            }

            @Override
            public ResultBean<List<BizLineResponseVo>> bizLinesByDataManagerOrAdminUserId(String userId) {
                return FeignClientTools.INSTANCE.errorMsgCatch(throwable, ServiceNameConstants.DapsApiStandard.PROD_SERVICE, "工号获取业务线失败");
            }

            @Override
            public ResultBean<List<BizLineResponseVo>> bizLinesByAdminUserId(String userId) {
                return FeignClientTools.INSTANCE.errorMsgCatch(throwable, ServiceNameConstants.DapsApiStandard.PROD_SERVICE, "工号获取业务线失败");
            }

            @Override
            public ResultBean<List<BizLineResponseVo>> bizLinesByAdminOrDevelopUserId(String userId) {
                return FeignClientTools.INSTANCE.errorMsgCatch(throwable, ServiceNameConstants.DapsApiStandard.PROD_SERVICE, "工号获取业务线失败");
            }

            @Override
            public ResultBean<List<BizLineDetailResponseVo>> bizLineDetailsByBizLineIdAndSystemId(Integer bizLineId, String systemId) {
                return ResultBean.ok(Collections.emptyList());
            }

        };
    }
}
